package cn.seaboot.admin.logger.web;

import cn.seaboot.admin.logger.bean.AccessLog;
import cn.seaboot.admin.logger.service.AccessLogService;
import cn.seaboot.admin.mvc.Pagination;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 系统日志 [t_sys_log_access] - Controller
 *
 * @author Mr.css 2018年8月22日 上午11:10:21
 */
@Controller
@Tag(name = "系统日志 [t_sys_log_access] 管理")
@RequestMapping("sys/log/access")
public class AccessLogCtrl {

    @Resource
    private AccessLogService accessLogService;

    /**
     * 查列表
     *
     * @param params 参数
     * @return PageInfo
     */
    @ResponseBody
    @Operation(description = "系统日志 [t_sys_log_access] 列表查询")
    @Parameters({@Parameter(name = "page", description = "页号"),
            @Parameter(name = "limit", description = "行数")})
    @RequestMapping(value = "page", method = RequestMethod.GET)
    public PageInfo<AccessLog> queryPage(@RequestParam Map<String, Object> params) {
        return Pagination.apply(params, map -> accessLogService.queryList(map));
    }
}
